import Score from "./Score";

export default class over extends Laya.Script {
    // 更多参数说明请访问: https://ldc2.layabox.com/doc/?nav=zh-as-2-4-0
    btn_start=null;
    btn_home=null;
    score=null;
    currentScore=null;
    owner=this.owner as Laya.Sprite
    constructor() { super(); }
    onAwake(){
        Laya.stage.on("over",this,this.over)
        this.btn_start=this.owner.getChildByName("btn_start")
        this.btn_home=this.owner.getChildByName("btn_home")
        this.score=this.owner.getChildByName("score")
        this.btn_home.on(Laya.Event.CLICK,this,this.home)
        this.btn_start.on(Laya.Event.CLICK,this,this.strat)
    }
    over(){
        this.owner.visible=true;
        this.currentScore=this.owner.parent.getChildByName("Score").getComponent(Score).score
        this.score.text="本次分数："+this.currentScore;
    }
    strat(){   
        Laya.stage.event("start")
        this.owner.visible=false;

    }
    home(){
        Laya.stage.event("home")
        this.owner.visible=false;
    }

}